package com.bwie.lib_core.bind.rvadapter;

import android.databinding.BindingAdapter;
import android.support.v7.widget.RecyclerView;
import android.util.Log;

import com.chad.library.adapter.base.BaseQuickAdapter;

/**
 * 自定义recyclerview中需要使用的设置适配器以及
 * 布局管理器等相关方法的自定义属性
 * */
public class BindRecyclerViewAdapter {

    @BindingAdapter(value = {"itemDecoration","adapter","layoutmanager"},requireAll = false)
    public static void bindRecycler(RecyclerView recyclerView,
                                    RecyclerView.ItemDecoration itemDecoration,
                                    BaseQuickAdapter adapter,
                                    RecyclerView.LayoutManager manager){
        Log.e("ZXY","bindRecycler"+(manager == null)+(adapter ==null));
        recyclerView.setLayoutManager(manager);
        if (itemDecoration!=null)
            recyclerView.addItemDecoration(itemDecoration);
        recyclerView.setAdapter(adapter);
    }

}
